<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/js/layui/css/layui.css" media="all">
</head>
<body>
<div style="width:80%;height:100%;margin:15px auto;overflow:auto;" id="aaa">
    <form class="layui-form" action="" id="update_staff">
        <input type="hidden" class="input-text" id="id" name="id">
        <input type="hidden" class="input-text" id="kk" name="kk">
        <div class="layui-form-item">
            <label class="layui-form-label">卡号</label>
            <div class="layui-input-inline" >
                <input type="text" id="cardNo" name="cardNo" readonly autocomplete="off" class="layui-input" />
            </div>
            <div class="layui-input-inline" style="width: 300px;line-height: 38px;">
                <span style="color: red;">请将工卡放入卡座，如未识别工卡，请重新放入</span>
            </div>
            <!--<div class="layui-form-mid layui-word-aux">辅助文字</div>-->
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">车辆牌照</label>
            <div class="layui-input-block">
                <input type="text" name="cl_paizhao" required lay-verify="required" autocomplete="off" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">品牌型号</label>
            <div class="layui-input-block">
                <input type="text" name="cl_pinpai" required lay-verify="required" autocomplete="off" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">归属类别</label>
            <div class="layui-input-block">
                <input type="text" name="cl_guishu_status" required lay-verify="required" autocomplete="off" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">归属人姓名</label>
            <div class="layui-input-block">
                <input type="text" name="cl_guishuren_name" autocomplete="off" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">住址</label>
            <div class="layui-input-block">
                <input type="text" name="cl_zhuzhi" autocomplete="off" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">核载人数</label>
            <div class="layui-input-block">
                <input type="text" name="cl_hezairen_num" autocomplete="off" readonly class="layui-input">
            </div>
            <!--<div class="layui-form-mid layui-word-aux">辅助文字</div>-->
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">总质量</label>
            <div class="layui-input-block">
                <input type="text" name="cl_zong_zhiliang" autocomplete="off" readonly class="layui-input">
            </div>
        </div>

        <div style="display: flex;flex-wrap: wrap">
            <div class="layui-form-item" style="width: 50%;margin-top: 15px">
                <label class="layui-form-label">前照</label>
                <div class="layui-input-block">
                    <img class="layui-upload-img" name="cl_qianzhao" id="cl_qianzhao" style="width: 200px;height: 150px">
                    <p id="demoText1"></p>
                </div>
                <input type="hidden" class="input-text" id="logo1" name="logo1">
            </div>
            <!--<div class="layui-form-item" style="width: 50%;margin-top: 15px">
                <label class="layui-form-label">后照</label>
                <div class="layui-input-block">
                    <img class="layui-upload-img" name="cl_houzhao" id="cl_houzhao" style="width: 200px;height: 150px">
                    <p id="demoText2"></p>
                </div>
                <input type="hidden" class="input-text" id="logo2" name="logo2">
            </div>
            <div class="layui-form-item" style="width: 50%;margin-top: 15px">
                <label class="layui-form-label">左照</label>
                <div class="layui-input-block">
                    <img class="layui-upload-img" name="cl_zuozhao" id="cl_zuozhao" style="width: 200px;height: 150px">
                    <p id="demoText3"></p>
                </div>
                <input type="hidden" class="input-text" id="logo3" name="logo3">
            </div>
            <div class="layui-form-item" style="width: 50%;margin-top: 15px">
                <label class="layui-form-label">右照</label>
                <div class="layui-input-block">
                    <img class="layui-upload-img" name="cl_youzhao" id="cl_youzhao" style="width: 200px;height: 150px">
                    <p id="demoText4"></p>
                </div>
                <input type="hidden" class="input-text" id="logo4" name="logo4">
            </div>-->
        </div>

        <div class="layui-form-item" style="margin-top: 20px">
            <div class="layui-input-block">
                <button class="layui-btn" id="clKk" lay-submit lay-filter="clKk">办理通行证</button>
            </div>
        </div>
    </form>
</div>
<script>
    //url 传参
    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var a = decodeURI(window.location.search);
        var r = a.substr(1).match(reg);//search,查询？后面的参数，并匹配正则
        if(r!=null)return  unescape(r[2]); return null;
    }
</script>
<script src="/js/layui/layui.all.js"></script>
<script src="/admin/js/token.js"></script>
<script src="./js/smartReader.js"></script>
<script src="./js/lock.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./js/card.js"></script>

<script>

    window.onload = function(){
        var form = layui.form;
        var $ = layui.jquery;
        $("input[name='id']").val(GetQueryString("id"));
        $("input[name='cl_guishuren_name']").val(GetQueryString("cl_guishuren_name"));
        $("input[name='cl_paizhao']").val(GetQueryString("cl_paizhao"));
        var cl_guishu_status = GetQueryString("cl_guishu_status");
        if (cl_guishu_status=="null" || cl_guishu_status==null || cl_guishu_status=="undefined" || cl_guishu_status == "") {
            $("input[name='cl_guishu_status']").val("");
        }else {
            if (cl_guishu_status == 1) {
                $("input[name='cl_guishu_status']").val("个人");
            }else {
                $("input[name='cl_guishu_status']").val("企业");
            }
        }
        var cl_pinpai = GetQueryString("cl_pinpai");
        if (cl_pinpai=="null" || cl_pinpai==null || cl_pinpai=="undefined" || cl_pinpai == "") {
            $("input[name='cl_pinpai']").val("");
        }else {
            $("input[name='cl_pinpai']").val(GetQueryString("cl_pinpai"));
        }
        var cl_zhuzhi = GetQueryString("cl_zhuzhi");
        if (cl_zhuzhi=="null" || cl_zhuzhi==null || cl_zhuzhi=="undefined" || cl_zhuzhi == "") {
            $("input[name='cl_zhuzhi']").val("");
        }else {
            $("input[name='cl_zhuzhi']").val(GetQueryString("cl_zhuzhi"));
        }
        var cl_hezairen_num = GetQueryString("cl_hezairen_num");
        if (cl_hezairen_num=="null" || cl_hezairen_num==null || cl_hezairen_num=="undefined") {
            $("input[name='cl_hezairen_num']").val("");
        }else {
            $("input[name='cl_hezairen_num']").val(GetQueryString("cl_hezairen_num"));
        }
        var cl_zong_zhiliang = GetQueryString("cl_zong_zhiliang");
        if (cl_zong_zhiliang=="null" || cl_zong_zhiliang==null || cl_zong_zhiliang=="undefined") {
            $("input[name='cl_zong_zhiliang']").val("");
        }else {
            $("input[name='cl_zong_zhiliang']").val(GetQueryString("cl_zong_zhiliang"));
        }
        $('#cl_qianzhao').attr('src', "/upload/"+GetQueryString("cl_qianzhao"));
        $('#cl_houzhao').attr('src', "/upload/"+GetQueryString("cl_houzhao"));
        $('#cl_zuozhao').attr('src', "/upload/"+GetQueryString("cl_zuozhao"));
        $('#cl_youzhao').attr('src', "/upload/"+GetQueryString("cl_youzhao"));
        $("input[name='logo1']").val(GetQueryString("cl_qianzhao"));
        $("input[name='logo2']").val(GetQueryString("cl_houzhao"));
        $("input[name='logo3']").val(GetQueryString("cl_zuozhao"));
        $("input[name='logo4']").val(GetQueryString("cl_youzhao"));
    }

    layui.use(['form' , 'jquery' , 'upload'], function(){
        var form = layui.form;
        var $ = layui.jquery;
        var upload = layui.upload;

        form.on('submit(clKk)',function(data){
            var cardNo = $("input[name='cardNo']").val();
            data.field.cardno=cardNo;
            data.field.id = $("#id").val();
            var picture = $("input[name='logo1']").val();
            if(cardNo==null || cardNo==""){
                layer.msg('请读取芯片');
            }else if (picture == null || picture == "") {
                layer.msg('没有上传车辆照片不能开卡');
            }else{
                write()
            }
            return false;
        });


    });
</script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        var endDate= laydate.render({
            elem: '#end_time',//选择器结束时间
            type: 'datetime',
            min:"1970-1-1",//设置min默认最小值
            done: function(value,date){
                startDate.config.max={
                    year:date.year,
                    month:date.month-1,//关键
                    date: date.date,
                    hours: 0,
                    minutes: 0,
                    seconds : 0
                }
            }
        });

        //日期范围
        var startDate=laydate.render({
            elem: '#start_time',
            type: 'datetime',
            max:"2099-12-31",//设置一个默认最大值
            done: function(value, date){
                endDate.config.min ={
                    year:date.year,
                    month:date.month-1, //关键
                    date: date.date,
                    hours: 0,
                    minutes: 0,
                    seconds : 0
                };
            }
        });
    });
</script>
</body>
</html>